/*******************************************************************************************************

Table 5: Compound treatment: change in the suffrage vs. change in representation

*******************************************************************************************************/

*Set directory path
cd "C:\Users\tsa23\Documents\petitions\replication files"

clear all

*read in our main dataset
use dta/did_rep.dta


*Elminate contrituencies which are not part of case G
drop if ID == 45 //University of Cambridge
drop if ID == 191 //University of Oxford
keep if new == 1 | drummond == .

drop if year==1830 | year==1831 | year==1832

gen treatgroup = 0
replace treatgroup =  1 if new==1 

gen treatinter = treatperiod*treatgroup

collapse ln_petitions Dvoters treatgroup, by(ID treatperiod treatinter)

label var treatinter "T * A" 
label var treatgroup "T" 
label var treatperiod "A" 

gen treatinter4 = treatperiod * treatgroup * Dvoters
label var treatinter4 " T * A * dV"
gen  treatinter41 = treatperiod  * Dvoters
label var treatinter41 "T * dV"
gen  treatinter42 = treatgroup * Dvoters
label var treatinter42 "A * dV"
label var Dvoters "dV"


reg ln_petitions treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42 treatinter4, cl(ID)
outreg2 treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4 $control using results\table5, nocons replace addt(Constituencies, 135, Case, G) asterisk(coef) auto(2) label ctitle(log (petitions +1)) sortvar(treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4) keep(treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4) se  symbol(**,*,+) tex(frag)



clear all

*read in our main dataset
use dta/did_rep.dta


*Elminate contrituencies which are not part of case L
drop if ID == 45 //University of Cambridge
drop if ID == 191 //University of Oxford
keep if sch_A==1 | sch_B == 1 | drummond!=.

drop if year==1830 | year==1831 | year==1832

gen treatgroup = 0
replace treatgroup =  1 if sch_A==1 

gen treatinter = treatperiod*treatgroup


collapse ln_petitions Dvoters treatgroup, by(ID treatperiod treatinter)

label var treatinter "T * A" 
label var treatgroup "T" 
label var treatperiod "A" 

gen treatinter4 = treatperiod * treatgroup * Dvoters
label var treatinter4 " T * A * dV"
gen  treatinter41 = treatperiod  * Dvoters
label var treatinter41 "T * dV"
gen  treatinter42 = treatgroup * Dvoters
label var treatinter42 "A * dV"
label var Dvoters "dV"

reg ln_petitions treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42 treatinter4, cl(ID)
outreg2 treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4 $control using results\table5, nocons append addt(Constituencies, 120, Case, L) asterisk(coef) auto(2) label ctitle(log (petitions +1)) sortvar(treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4) keep(treatgroup treatperiod Dvoters treatinter treatinter41 treatinter42  treatinter4) se symbol(**,*,+) tex(frag)



clear all

*read in our main dataset
use dta/did_rep.dta


*Elminate contrituencies which did not exist BOTH before and after 
drop if new== 1
drop if sch_A == 1
drop if year==1830 | year==1831 | year==1832

*replace voters = 0 if voters==.
collapse ln_petitions voters pop_i Dvoters, by(ID treatperiod)

gen ln_pop_i = log(pop_i)
label var ln_pop_i "Log Population"
label var pop_i "Population"
gen ln_voters = log(voters)
label var ln_voters "Log voters"
gen year = treatperiod
tsset ID year

gen treatgroup = 0 // dummy so that the label can be created for the output
gen treatinter = treatperiod * treatgroup
label var treatinter "T * A" 
label var treatgroup "T" 
label var treatperiod "A" 

gen treatinter4 = treatperiod * treatgroup * Dvoters
label var treatinter4 " T * A * dV"
gen  treatinter41 = treatperiod  * Dvoters
label var treatinter41 "T * dV"
gen  treatinter42 = treatgroup * Dvoters
label var treatinter42 "A * dV"
label var Dvoters "dV"


xtreg ln_petitions ln_voters ln_pop_i i.year, fe cluster(ID)
outreg2 ln_voters ln_pop_i using results\table5, nocons append addt(Constituencies, 157, Case, n.a.) asterisk(coef) auto(2) label ctitle(log (petition + 1)) keep(  ln_voters ln_pop_i) se symbol(**,*,+) tex(frag) 